package com.ruoyi.management_controller.PublicOpinion.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import com.ruoyi.management_controller.PublicOpinion.mapper.PublicOpinionMapper;
import com.ruoyi.management_controller.PublicOpinion.domain.PublicOpinion;
import com.ruoyi.management_controller.PublicOpinion.service.IPublicOpinionService;

/**
 * 民情动态Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-19
 */
@Service
public class PublicOpinionServiceImpl implements IPublicOpinionService 
{
    @Autowired
    private PublicOpinionMapper publicOpinionMapper;

    /**
     * 查询民情动态
     * 
     * @param opinionId 民情动态主键
     * @return 民情动态
     */
    @Override
    public PublicOpinion selectPublicOpinionByOpinionId(Long opinionId)
    {
        return publicOpinionMapper.selectPublicOpinionByOpinionId(opinionId);
    }

    /**
     * 查询民情动态列表
     * 
     * @param publicOpinion 民情动态
     * @return 民情动态
     */
    @Override
    public List<PublicOpinion> selectPublicOpinionList(PublicOpinion publicOpinion)
    {
        return publicOpinionMapper.selectPublicOpinionList(publicOpinion);
    }

    public List<PublicOpinion> selectPublicOpinionListByvoterId(PublicOpinion publicOpinion){
        return publicOpinionMapper.selectPublicOpinionListByvoterId(publicOpinion);
    }

    /**
     * 新增民情动态
     * 
     * @param publicOpinion 民情动态
     * @return 结果
     */
    @Override
    public int insertPublicOpinion(PublicOpinion publicOpinion)
    {
        publicOpinion.setSubmitTime(DateUtils.getNowDate());
        return publicOpinionMapper.insertPublicOpinion(publicOpinion);
    }

    /**
     * 修改民情动态
     * 
     * @param publicOpinion 民情动态
     * @return 结果
     */
    @Override
    public int updatePublicOpinion(PublicOpinion publicOpinion)
    {

        return publicOpinionMapper.updatePublicOpinion(publicOpinion);
    }

    /**
     * 批量删除民情动态
     * 
     * @param opinionIds 需要删除的民情动态主键
     * @return 结果
     */
    @Override
    public int deletePublicOpinionByOpinionIds(Long[] opinionIds)
    {
        return publicOpinionMapper.deletePublicOpinionByOpinionIds(opinionIds);
    }

    /**
     * 删除民情动态信息
     * 
     * @param opinionId 民情动态主键
     * @return 结果
     */
    @Override
    public int deletePublicOpinionByOpinionId(Long opinionId)
    {
        return publicOpinionMapper.deletePublicOpinionByOpinionId(opinionId);
    }
}
